function ajaxteatimer(url) {
	getPaperbaseData(url);
	setTimeout("ajaxteatimer()", 8000);
}


function helpoff(foo){
string="document.getElementById('"+foo+"').style.display='none'";
string="document.getElementById('"+foo+"').style.display='none'";
string="document.getElementById('"+foo+"').style.display='visible'";
setTimeout(string,3000);
};

function helpon(foo){
alloff();
document.getElementById(foo).style.display='block';
};

function commenton(foo){
	document.getElementById('off'+foo).style.display='block';
	document.getElementById('on'+foo).style.display='none';
	document.getElementById('comment'+foo).style.display='block';
};

function commentoff(foo){
        document.getElementById('off'+foo).style.display='none';
        document.getElementById('comment'+foo).style.display='none';
        document.getElementById('on'+foo).style.display='block';
};


function getPaperbaseData(url){
	url="http://192.168.105.114:8080/metadata/dc?id=f76a881e1ddde5dc";
	var httprequest=makeRequest(url);
	useContents(httprequest);
}

function makeRequest(url) {
// taken from the moz tutorial
        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { useContents(http_request); };
        http_request.open('GET', url, true);
        http_request.send(null);

    }

function useContents(http_request) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                                var xmldoc=http_request.responseXML;

                                var root_node=xmldoc.getElementsByTagName('ResultSet').item(0);
                                // you can be sure to have a resultset,
                                // but may not have any results
                                // <ResultSet><Result></Result></ResultSet>
                                var result_nodes=xmldoc.getElementsByTagName('Result');
                                var resultoutput="";
                                if(result_nodes.length>0){
                                        for (var iCount=0; iCount<result_nodes.length; iCount++){
                                                alert("Result!"+result_nodes.item(iCount).firstChild.nodeValue);
                                                if(iCount>0){
                                                        resultoutput=resultoutput+", "+result_nodes.item(iCount).firstChild.nodeValue;
                                                } else {
                                                        resultoutput=result_nodes.item(iCount).firstChild.nodeValue;


                                                }
                                                //item(iCount).nodeValue);

                                        }
                                        //document.getElementById('myresponses').innerHTML=resultoutput;
                                } else {
                                        //document.getElementById('myresponses').innerHTML="No keywords were given";
                                }
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

